<?xml version="1.0" encoding="UTF-8"?><d:tdl xmlns="http://www.w3.org/1999/xhtml" xmlns:b="http://www.backbase.com/2006/btl"  xmlns:d="http://www.backbase.com/2006/tdl" >

	<d:namespace name="http://www.backbase.com/2006/btl">

		<d:uses element="windowBase" src="../windowBase.xml"/>

		<d:element name="window" extends="b:windowBase">
			

			<d:resource type="text/css"><![CDATA[.btl-window {
	position: absolute;
	overflow: hidden;
	/* this index was chosen to overelap all none floating elements, cause they can still use
	   z-index to solve some browser issues, and to be under all other floating elements, that
	   can possibly be on the same level with window */
	z-index: 100;
}
.btl-window-inline {
	position: relative;
}
.btl-window-head,
.btl-window-head-right,
.btl-window-head-mid {
	background-image: url(media/windowHead.png);
}
.btl-window-head,
.btl-window-head-right{
	background-repeat: no-repeat;
}
.btl-window-head {
	cursor: move;
	padding-left: 4px;
	background-position: 0 -500px;
}
.btl-window-head-right {
	padding-right: 4px;
	background-position: 100% -300px;
}
.btl-window-head-mid {
	background-repeat: repeat-x;
	background-position: 0 -100px;
}
.btl-window-head .btl-icon {
	/* trying to optically center the icon */
	background-position: 4px 60%;
}
.btl-window-label {
	cursor: move;
	font-weight: bold;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: #919191;
}
.btl-window-button {
	display: none;
	width: 14px;
	height: 13px;
	margin-top: 4px;
	margin-left: 4px;
	cursor: pointer;
	float: right;
	background-color: #000000;
}
.btl-window-minimizeRestoreButton {
	background-image: url(media/minimizeRestoreButton.png);
	background-position: -14px 0;
}
.btl-window-maximizeRestoreButton {
	background-image: url(media/maximizeRestoreButton.png);
	background-position: -14px 0;
}
.btl-window-closeButton {
	background-image: url(media/closeButton.png);
	background-position: -14px 0;
}
.btl-window-content-border {
	border-width: 0 1px 1px 1px;
	border-style: solid;
	border-color: #C8C8C8;
	background-color: #FAFAFA;
	padding: 0 3px 3px 3px;
}
.btl-window-content {
	position: relative;
	overflow: auto;
	background-color: #FFFFFF;
}
/* active */
.btl-window-active .btl-window-head {
	background-position: 0 -400px;
}
.btl-window-active .btl-window-head-right {
	background-position: 100% -200px;
}
.btl-window-active .btl-window-head-mid {
	background-position: 0 0;
}
.btl-window-active .btl-window-label {
	color: #000000;
}
.btl-window-active .btl-window-minimizeRestoreButton,
.btl-window-active .btl-window-maximizeRestoreButton,
.btl-window-active .btl-window-closeButton {
	background-position: 0 0;
}
.btl-window-active .btl-window-content-border {
	border-color: #919191;
	background-color: #EDEDED;
}
/* maximized */
.btl-window-maximized .btl-window-head,
.btl-window-maximized .btl-window-label {
	cursor: default;
}
/* button states */
.btl-window-closeButton-hover {
	background-position: 0 -13px;
}
.btl-window-closeButton-press {
	background-position: 0 -26px;
}
.btl-window-minimizeRestoreButton-hover,
.btl-window-maximizeRestoreButton-hover {
	background-position: 0 -26px;
}
.btl-window-minimizeRestoreButton-press,
.btl-window-maximizeRestoreButton-press {
	background-position: 0 -52px;
}
.btl-window-minimized .btl-window-minimizeRestoreButton,
.btl-window-maximized .btl-window-maximizeRestoreButton {
	background-position: 0 -13px;
}
.btl-window-minimized .btl-window-minimizeRestoreButton-hover,
.btl-window-maximized .btl-window-maximizeRestoreButton-hover {
	background-position: 0 -39px;
}
.btl-window-minimized .btl-window-minimizeRestoreButton-press,
.btl-window-maximized .btl-window-maximizeRestoreButton-press {
	background-position: 0 -65px;
}
/* fixes */
.ie .btl-window-content-border {
	zoom: 1.0;
	overflow: hidden;
}
.ie .btl-window-button {
	overflow: hidden;
}
.ie .btl-window-head-right {
	height: 100%;
}
.btl-window .btl-window-head-mid {
	/* To equalize height with other head elements. Window head was two pixels lower due to the border being in an image. */
	padding-top: 1px;
	padding-bottom: 1px;
}
.ie .btl-window-content,
.ie .btl-window-content-border,
.ie .btl-window .btl-window-label {
	width: 100%;
}
.ie .btl-window-inline .btl-window-head {
	/* if not set, background-images do not appear correctly in the head */
	zoom: 1.0;
}
]]></d:resource>
			<d:resource type="image/png" src="media/windowHead.png"/>
			<d:resource type="image/png" src="media/closeButton.png"/>
			<d:resource type="image/png" src="media/maximizeRestoreButton.png"/>
			<d:resource type="image/png" src="media/minimizeRestoreButton.png"/>

			<d:template type="application/xhtml+xml">
				<div class="btl-window btl-window-active">
					<div class="btl-window-head btl-head btl-dragMove">
						<div class="btl-window-head-right">
							<div class="btl-window-head-mid">
								<div class="btl-window-buttons">
									<div class="btl-window-button btl-window-closeButton"/>
									<div class="btl-window-button btl-window-maximizeRestoreButton"/>
									<div class="btl-window-button btl-window-minimizeRestoreButton"/>
								</div>
								<div class="btl-window-label btl-label"> </div>
							</div>
						</div>
					</div>
					<div class="btl-window-content-border">
						<div class="btl-window-content">
							<d:content/>
						</div>
					</div>
				</div>
			</d:template>

			<d:attribute name="width" default="350px"/>

			<d:attribute name="height" default="250px"/>

			<d:attribute name="resizeMinWidth" default="150px"/>

			<d:attribute name="resizeMinHeight" default="32px"/>

			<d:attribute name="useDragClass" default="true">
				
			</d:attribute>

			<d:attribute name="buttons">
				<d:mapper type="text/javascript"><![CDATA[
					if ( value != 'none' ) {
						var sButtons = this.getAttribute('buttons');
						var aValues = sButtons.split(' ');

						for ( var i = aValues.length-1; i >= 0; i = i-1 ){
							var oButton = null;

							switch ( aValues[i] ) {
								case 'close':
									oButton = bb.selector.query(this.viewNode, '.btl-window-closeButton');
									break;
								case 'maximize':
									oButton = bb.selector.query(this.viewNode, '.btl-window-maximizeRestoreButton');
									break;
								case 'minimize':
									oButton = bb.selector.query(this.viewNode, '.btl-window-minimizeRestoreButton');
									break;
							}

							if(oButton){
								// display button
								oButton.style.display = 'block';
							}
						}
					}
				]]></d:mapper>
			</d:attribute>

			<d:attribute name="mode">
				<d:mapper type="text/javascript"><![CDATA[
					value == 'inline' ? bb.html.addClass(this.viewNode, 'btl-window-inline') : bb.html.removeClass(this.viewNode, 'btl-window-inline');
				]]></d:mapper>
			</d:attribute>

			<d:property name="height">
				<d:setter type="text/javascript"><![CDATA[
					this.viewNode.style.height = value;
					this._._height = value;
					bb.ui.reflow(this, true, true);
				]]></d:setter>
			</d:property>

			<d:method name="maximize">
				<d:body type="text/javascript"><![CDATA[
					bb.html.removeClass(this.viewNode, 'btl-window-minimized');
					this.callSuper('maximize');
					bb.html.addClass(this.viewNode, 'btl-window-maximized');
				]]></d:body>
			</d:method>

			<d:method name="minimize">
				<d:body type="text/javascript"><![CDATA[
					bb.html.removeClass(this.viewNode, 'btl-window-maximized');
					this.callSuper('minimize');
					bb.html.addClass(this.viewNode, 'btl-window-minimized');
				]]></d:body>
			</d:method>

			<d:method name="restore">
				<d:body type="text/javascript"><![CDATA[
					bb.html.removeClass(this.viewNode, 'btl-window-minimized');
					this.callSuper('restore');
					if (this._['_maximized']) {
						bb.html.addClass(this.viewNode, 'btl-window-maximized');
					} else {
						bb.html.removeClass(this.viewNode, 'btl-window-maximized');
					}
				]]></d:body>
			</d:method>

			<d:constructor type="text/javascript"><![CDATA[
				// disable user select on window head
				bb.html.disableUserSelect(this.viewNode.firstChild);
				// internal property to allow taskBar open window context menu
				// it's temporary solution until window/windowArea/windowManager menu support is developed
				this.__windowHead = this.viewNode.firstChild;
			]]></d:constructor>

			<d:handler event="mousedown" match=".btl-window-button" type="text/javascript"><![CDATA[
				bb.html.addClass(event.currentView, 'btl-window-button-press');
			]]></d:handler>

			<d:handler event="mousedown" match=".btl-window-closeButton" type="text/javascript"><![CDATA[
				bb.html.addClass(event.currentView, 'btl-window-closeButton-press');
			]]></d:handler>

			<d:handler event="mousedown" match=".btl-window-maximizeRestoreButton" type="text/javascript"><![CDATA[
				bb.html.addClass(event.currentView, 'btl-window-maximizeRestoreButton-press');
			]]></d:handler>

			<d:handler event="mousedown" match=".btl-window-minimizeRestoreButton" type="text/javascript"><![CDATA[
				bb.html.addClass(event.currentView, 'btl-window-minimizeRestoreButton-press');
			]]></d:handler>

			<d:handler event="mouseup" match=".btl-window-button" type="text/javascript"><![CDATA[
				bb.html.removeClass(event.currentView, ['btl-window-button-press', 'btl-window-closeButton-press', 'btl-window-maximizeRestoreButton-press', 'btl-window-minimizeRestoreButton-press']);
				bb.html.replaceClass(event.currentView, 'btl-chameleon-activeBackground', 'btl-chameleon-highlightBackground');
			]]></d:handler>

			<d:handler event="mouseenter" match=".btl-window-button" type="text/javascript"><![CDATA[
				bb.html.addClass(event.currentView, 'btl-chameleon-highlightBackground');
			]]></d:handler>

			<d:handler event="mouseenter" match=".btl-window-closeButton" type="text/javascript"><![CDATA[
				bb.html.addClass(event.currentView, 'btl-window-closeButton-hover');
			]]></d:handler>

			<d:handler event="mouseenter" match=".btl-window-maximizeRestoreButton" type="text/javascript"><![CDATA[
				bb.html.addClass(event.currentView, 'btl-window-maximizeRestoreButton-hover');
			]]></d:handler>

			<d:handler event="mouseenter" match=".btl-window-minimizeRestoreButton" type="text/javascript"><![CDATA[
				bb.html.addClass(event.currentView, 'btl-window-minimizeRestoreButton-hover');
			]]></d:handler>

			<d:handler event="mouseleave" match=".btl-window-button" type="text/javascript"><![CDATA[
				bb.html.removeClass(event.currentView,
					['btl-chameleon-highlightBackground',
					 'btl-chameleon-activeBackground',
					 'btl-window-button-hover',
					 'btl-window-closeButton-hover',
					 'btl-window-maximizeRestoreButton-hover',
					 'btl-window-minimizeRestoreButton-hover',
					 'btl-window-button-press',
					 'btl-window-closeButton-press',
					 'btl-window-maximizeRestoreButton-press',
					 'btl-window-minimizeRestoreButton-press']);
			]]></d:handler>

			<d:handler event="click" match=".btl-window-closeButton" type="text/javascript"><![CDATA[
				this.close();
			]]></d:handler>

			<d:handler event="click" match=".btl-window-maximizeRestoreButton" type="text/javascript"><![CDATA[
				this.setProperty('maximized', !this.getProperty('maximized'));
			]]></d:handler>

			<d:handler event="click" match=".btl-window-minimizeRestoreButton" type="text/javascript"><![CDATA[
				this.setProperty('minimized', !this.getProperty('minimized'));
			]]></d:handler>

			<d:handler event="reflow" type="text/javascript"><![CDATA[
				var oElm = bb.selector.query(this.viewNode, '.btl-window-content-border');
				if (this.hasAttribute('height') && this.getAttribute('height') !== 'auto') {
					btl.html.stretch(oElm);
					btl.html.stretch(oElm.firstChild);
				} else {
					oElm.style.height = '';
					oElm.firstChild.style.height = '';
				}
			]]></d:handler>

			<d:handler event="dragStart" type="text/javascript"><![CDATA[
				var oButtonContainer = bb.selector.query(this.viewNode, '.btl-window-buttons');
				if (btl.containsElement(oButtonContainer, event.viewTarget)){
					event.preventDefault();
				}
			]]></d:handler>
		</d:element>
	</d:namespace>
</d:tdl>